# coding:utf-8
from appium import webdriver
from time import sleep
import unittest
from model.HTMLTestRunner_cn import HTMLTestRunner
from page.app import App


class demo2(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        # cls.driver = AppPo().start()
        cls.home = App.start()

    def tearDown(self):
        App.quit()
    def test_case001(self):

        # self.main_page.to_search_page().search("星球").get_text()
        if "测试" in self.home.to_search_page().search("测试").get_text():
            print("搜索成功")
        else:
            print("搜索不匹配")


if __name__ == '__main__':
    suites = unittest.TestSuite()
    suites.addTest(demo2("test_case001"))
    runner = HTMLTestRunner(
            title="带截图和日志的测试报告",
            description="带截图和日志的测试报告",
            stream=open("./report/report_xqxc.html", 'wb'),
            verbosity=2,
            # retry=2,
            save_last_try=True
    )
    runner.run(suites)

